// pages/mingpian/wangpu/jieshao/jieshao.js
import http from "../../../../class/Utils/Http"
import tips from "../../../../class/Utils/Tips"
Page({

    /**
     * 页面的初始数据
     */
    data: {},
    onLoad:function (get) {
        var that = this
        this.setData({
            mid:get.mid
        })
        var user = wx.getStorageSync('user');
        http.reqload("/Mingpian/chakan", {id: get.mid, uid: user.userid}, function (infores) {

            that.setData({
                info: infores,
            })
        })
    },
    //监听 page 滚动条位置
    onPageScroll: function (res) {
        //console.log(res.scrollTop);
        if (res.scrollTop >= 167) {
            this.setData({
                floorstatus: true
            })
        } else {
            this.setData({
                floorstatus: false
            })
        }
    },
//page 返回顶部 点击顶部时间未知也可返回顶部
    pagegotop: function (e) {
        wx.pageScrollTo({
            scrollTop: 0,
            duration: 300
        })
    },
//
    //去首页
    gotohome: function () {
        wx.switchTab({
            url: '/pages/index/index'
        })
    },
    //去名片
    gotowodemingpian:function(e){
        wx.reLaunch({
            url: '/pages/mingpian/card/card?id='+this.data.mid
        })
    },
    // //去旺铺
    // gotowangpu:function(){
    //     wx.reLaunch({
    //         url: '/pages/mingpian/wangpu/index/index?mid='+this.data.mid
    //     })
    // },
    // //去企业介绍
    // gotojieshao:function(){
    //     wx.reLaunch({
    //         url: '/pages/mingpian/wangpu/jieshao/jieshao?mid=' + this.data.id
    //     })
    // },
    gotowangpu:function(){
        var info = this.data.info
        if(info.wx_user.toocle_cid == 0){
            tips.error("暂无旺铺")
            return false
        }
        if(info.wx_user.toocle_cid==100387){
            tips.redirectTo('/pages/mingpian/wangpu/index/index?mid='+this.data.info.id);
        }else{
            tips.redirectTo("/pages/toocle/shop/index/index?cid="+info.wx_user.toocle_cid+"&time="+info.wx_user.toocle_ctime+"&quanmenuid=1");
        }

    },
    //去企业介绍
    gotojieshao:function(){
        var info = this.data.info
        if(info.wx_user.toocle_cid == 0){
            tips.error("暂无旺铺")
            return false
        }
        if(info.wx_user.toocle_cid==100387){
            tips.redirectTo('/pages/mingpian/wangpu/jieshao/jieshao?mid='+this.data.info.id);
        }else{
            tips.redirectTo("/pages/toocle/shop/index/index?cid="+info.wx_user.toocle_cid+"&time="+info.wx_user.toocle_ctime+"&quanmenuid=3");
        }
    },
})